const crypto = require("node:crypto")

const secret = "yang jun"
const hash = crypto.createHmac("sha256", secret).update("i love node.js a").digest("base64")

console.log(hash);


// 确认加密是否可用
// let crypto;
// try {
//   crypto = await import('node:crypto');
// } catch (err) {
//   console.error('crypto support is disabled!');
// }